void kernel_main(multiboot_info* multiboot_information, u32int magic_number, void* stack_pointer) {
    init_kernel();
	
    if(!multiboot_sane(magic_number)) {
	   printf ("Invalid multiboot magic number: 0x%x\n", magic_number);
	   exit(1);
    }

	prepare_video(multiboot_information);
	
	#ifdef BOOT_TEXT_MODE
	go_text_mode();
	display_boot_screen(multiboot_information);
    #endif

    void* heap_start = find_oceania_module(multiboot_information);
    if(!heap_start) {
		printf("Oceania image not loaded as multiboot module.\n");
		exit(1);
	}
	
	interpreterMain(heap_start,  multiboot_information->mem_upper * 1024 - 0x10000);
}

void init_kernel() {
	stop_interrupts();
    init_dtables();
    init_clock(500);
    init_prim16int();
	init_terminal();
    start_interrupts();
}

void display_boot_screen(multiboot_info* multiboot_information) {
	preserve_colors();
	set_fgbg(WHITE, BLUE);
    printf("Oceania, the Newspeak-based operating system.\n\n");
    display_memory_info(multiboot_information);
    endl();
    display_module_info(multiboot_information);
    endl();
	restore_colors();
}
